<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>OOJS-继承</title>
    <script src="./js01_oojs_03.js" async></script>
    <link rel="stylesheet" href="../style/common.css">
</head>
<body>
    <h1>OOJS-继承</h1>
    <p class="msg"></p>
    <script>
        document.addEventListener("DOMContentLoaded",function(){
            let msg = document.querySelector(".msg");

            //传概念实例化对象是，直接使用原型方法，并且因为使用了this指向，所以打印的内容都是活泛的
            let person = new Person("张三");
            msg.innerHTML +=person.sayHello();
            msg.innerHTML +="<br>";

            let teacher =new Teacher("李四","软件工程");
            msg.innerHTML +=teacher.sayHello();
            msg.innerHTML +="<br>";

            msg.innerHTML +=teacher.walk();

            console.log(teacher.__proto__);
            console.log(teacher.__proto__ ===Teacher.prototype);
            console.log(teacher.__proto__.constructor);
            console.log(teacher.__proto__.walk);
            console.log(teacher.__proto__.__proto__.constructor);
            console.log(teacher.__proto__.__proto__.__proto__.constructor);
            console.log(Teacher.prototype.__proto__.sayHello);
            


        });
    </script>
</body>
</html>